<template>
    <a-modal v-model:open="open" title="餐馆显示距离控制(0-50000m)" @ok="handleOk">
        <a-input v-model:value="inputvalue" placeholder="默认显示距离(300m)" />
    </a-modal>
</template>
<script setup>
import { ref, watch } from 'vue';
import { spotsInfoStore } from '@/stores/spots';
const spotsStore = spotsInfoStore()
const inputvalue = ref()
const open = ref(false);

const handleOk = e => {
    console.log(inputvalue.value, 'inputvalue');
    open.value = false
    if (inputvalue.value != null) {
        // console.log('传值成功');
        spotsStore.SetRadius(inputvalue.value)
        // console.log(spotsStore.Radius, typeof spotsStore.Radius);
    } else {
        // console.log('传递默认值');
        spotsStore.SetRadius('300')
        // console.log(spotsStore.Radius, typeof spotsStore.Radius);

    }
    // spotsStore.SetFuncFoodOn(false)
};

// 监听 spotsStore.foodopen 的变化
watch(() => spotsStore.FuncFoodOn, (newVal) => {
    open.value = newVal;
});
</script>
<style lang="scss" scoped></style>